package com.cdx.spring.juc.printtrhead;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author chedx
 * @data 2021/2/28 11:04 AM
 */
public class TestMain {
    private static AtomicInteger i = new AtomicInteger(0);

    public static void main(String[] args) {
        ReentrantLock lock = new ReentrantLock();
        Condition condition = lock.newCondition();

        ExecutorService threadPool = Executors.newFixedThreadPool(3);

        PrintThread t1 = new PrintThread("A", condition, 0, lock);
        PrintThread t2 = new PrintThread("B", condition, 1, lock);
        PrintThread t3 = new PrintThread("C", condition, 2, lock);
        threadPool.submit(t1);
        threadPool.submit(t2);
        threadPool.submit(t3);



    }
}
